<?php


class Media_Url extends WSB_Controller_Url
{
	/**
	 * @param string $folder
	 * @return string
	 */
	public static function fileListUrl($folder=null)
	{
	    $globals = array();
	    if(isset($folder)) {
            $globals = array('folder' => $folder);
	    }
		return self::getUrl('file', null, array(), 'media', $globals);
	}

	/**
	 * @param string $folder
	 * @return string
	 */
	public static function fileBrowserUrl($folder=null)
	{
	    $globals = array();
	    if(isset($folder)) {
            $globals = array('folder' => $folder);
	    }
		return self::getUrl('file', 'browser', array(), 'media', $globals);
	}

	/**
	 * @param string $folder
	 * @return string
	 */
	public static function fileFckeditorUrl($folder=null)
	{
	    $globals = array();
	    if(isset($folder)) {
            $globals = array('folder' => $folder);
	    }
		return self::getUrl('file', 'fckeditor', array(), 'media', $globals);
	}

	/**
	 * @param string $file
	 * @return string
	 */
	public static function fileDeleteUrl($file)
	{
		$folder = WSB_Div::dirname($file);
		return self::getUrl('file', 'delete', array(), 'media', array('folder' => $folder, 'file' => $file));
	}

	/**
	 * @param string $file
	 * @return string
	 */
	public static function cutUrl($file)
	{
		$folder = WSB_Div::dirname($file);
		return self::getUrl('file', 'cut', array(), 'media', array('folder' => $folder, 'cut' => $file));
	}

	/**
	 * @param string $file
	 * @return string
	 */
	public static function pasteUrl($file)
	{
		$folder = WSB_Div::dirname($file);
		return self::getUrl('file', 'paste', array(), 'media', array('folder' => $folder, 'paste' => $file));
	}

	/**
	 * @param string $path
	 * @return string
	 */
	public static function trashListUrl($path)
	{
		return self::getUrl('trash', 'list', null, 'media') . '?folder=' . $path;
	}

	/**
	 * @return string
	 */
	public static function trashEmptyUrl()
	{
		return self::getUrl('trash', 'empty', null, 'media');
	}

	/**
	 * @param string $file
	 * @return string
	 */
	public static function trashRestoreUrl($file)
	{
		$folder = WSB_Div::dirname($file);
		return self::getUrl('trash', 'restore', null, 'media', array('folder' => $folder, 'file' => $file));
	}

	/**
	 * @param string $folder
	 * @return string
	 */
	public static function uploadListUrl($folder=null)
	{
	    $globals = array();
	    if(isset($folder)) {
            $globals = array('folder' => $folder);
	    }
		return self::getUrl('upload', 'index', array(), 'media', $globals);
	}

	/**
	 * @return string
	 */
	public static function uploadMkdirUrl()
	{
		return self::getUrl('upload', 'mkdir', null, 'media');
	}

}
